<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">合作方大额数据统计</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{largePartnerStatListBean.onReset}"
                                         process="@this"
                                         update="@form"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         ajax="false">
                            <p:dataExporter type="xls" target="userapplylist" fileName="stat-data"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <div class="ui-g-12">
                                <h3>查询条件</h3>
                            </div>
                            <div class="ui-g-1">
                                <p:outputLabel value="开始日期"/>
                            </div>
                            <div class="ui-g-3">
                                <p:calendar id="startDate"
                                            value="#{largePartnerStatListBean.$.startDate}"
                                            styleClass="autoWidthCalendar"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>
                                <span>—</span>
                                <p:calendar id="endDate"
                                            value="#{largePartnerStatListBean.$.endDate}"
                                            styleClass="autoWidthCalendar"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>
                            </div>

                            <div class="ui-g-1">
                                <p:outputLabel value="来源"/>
                            </div>
                            <div class="ui-g-3">
                                <p:selectOneMenu value="#{largePartnerStatListBean.$.from}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems value="#{largePartnerStatListBean.totalChannel}"
                                                   var="comeFrom"
                                                   itemLabel="#{comeFrom}"
                                                   itemValue="#{comeFrom}"/>
                                </p:selectOneMenu>
                            </div>

                        </div>

                        <div class="card">
                            <p:dataTable id="userapplylist"
                                         style="width: 100%"
                                         var="info"
                                         value="#{largePartnerStatListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         reflow="true"
                                         resizableColumns="true">
                                <p:column headerText="日期">
                                    <h:outputText value="#{info.statDate}"/>
                                </p:column>
                                <p:column headerText="来源">
                                    <h:outputText value="#{info.from}"/>
                                </p:column>
                                <p:column headerText="可投递用户">
                                    <h:outputText value="#{info.canApply}"/>
                                </p:column>
                                <p:column headerText="去到第二页数">
                                    <h:outputText value="#{info.toSecond}"/>
                                </p:column>
                                <p:column headerText="申请人数">
                                    <h:outputText value="#{info.applyCount}"/>
                                </p:column>
                                <p:column headerText="申请成功人数">
                                    <h:outputText value="#{info.applySuccess}"/>
                                </p:column>
                                <p:column headerText="申请失败人数">
                                    <h:outputText value="#{info.applyFail}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
